package com.lzp.exception;

import com.lzp.utils.JSONResult;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

import javax.servlet.http.HttpServletRequest;

/**
 * @description: Ajax异常输出类
 * @author: lzp
 * @createTime: 2021-08-01 23:54
 **/
//@RestControllerAdvice
public class AjaxExceptionHandler {

    @ExceptionHandler(value = Exception.class)
    public JSONResult defaultErrorHandler(HttpServletRequest request, Exception e) {
        e.printStackTrace();
        return JSONResult.errorException(e.getMessage());
    }
}
